package com.anabur.bean.table;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

public class RubroDataModel extends ListDataModel<RubroTableItem> implements SelectableDataModel<RubroTableItem>{

    public RubroDataModel(List<RubroTableItem> list) {
        super(list);
    }    

    @Override
    public RubroTableItem getRowData(String rowKey) {
        List<RubroTableItem> rubroList = (List<RubroTableItem>)this.getWrappedData();
        for(RubroTableItem rubro : rubroList){
            if(rubro.getNombreRubro().equalsIgnoreCase(rowKey)){
                return rubro;
            }
        }
        return null;
    }

	@Override
	public Object getRowKey(RubroTableItem item) {
		return item.getNombreRubro();
	}

}